// 引入此文件需自建如下内容：
// footerButtons
import { transferDataDetail } from '@/components/task/utils';
import { PLAN_TYPE } from '@/constants';
import { mapGetters } from 'vuex';
import TreeGraph from '@/components/Graph/TreeGraph.vue';

export default {
  components: {
    TreeGraph,
  },
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    formInfo: {
      type: Object,
      default: () => ({}),
    },
    visibled: {
      type: Boolean,
      default: false,
    },
    hasEdit: {
      type: Boolean,
      default: false,
    },
    processId: {
      type: [String, Number],
      default: '',
    },
  },
  data() {
    this.PLAN_TYPE = PLAN_TYPE;
    return {
      disabled: false,
    };
  },
  computed: {
    applicationState() {
      return this.$store.state.dictionary.dict['application'] || {};
    },
    productionPlaceOptions() {
      return this.$store.state.dictionary.dict['production_place'] || {};
    },
    applicationOptions() {
      return this.$store.state.dictionary.dict['application'] || {};
    },
    ...mapGetters(['spinning']),

    filterButtons() {
      if (this.hasEdit) return this.footerButtons;
      return this.footerButtons.filter(item => !item.auth);
    },
    footerButtons() {
      if (this.formData.isCurrentProcessor) {
        return [
          {
            key: 'submit',
            type: 'primary',
            label: '提交',
          },
          {
            key: 'retweet',
            label: '转他人处理',
            icon: 'retweet',
          },
          {
            key: 'close',
            label: '返回',
          },
        ];
      } else if (this.formData.isWithdraw) {
        return [
          {
            key: 'recall',
            label: '撤回',
          },
          {
            key: 'close',
            label: '返回',
          },
        ];
      } else {
        return [
          {
            key: 'close',
            label: '返回',
          },
        ];
      }
    },
  },
  watch: {},
  methods: {
    submitCallback() {
      this.$confirm('确认提交？提交后基本信息不允许再修改！', '提交确认', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          this.getSubmit();
        })
        .catch(err => {
          console.log(err);
        });
    },
  },
};
